package cn.sumpu.app.guoguojie.biz.impl;

import java.util.List;

import cn.sumpu.app.guoguojie.biz.AddressCodeBiz;
import cn.sumpu.app.guoguojie.dao.AddressCodeDao;
import cn.sumpu.app.guoguojie.domain.AddressCode;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public class AddressCodeBizImpl implements AddressCodeBiz {

	private AddressCodeDao addressCodeDao;

	public void setAddressCodeDao(AddressCodeDao addressCodeDao) {
		this.addressCodeDao = addressCodeDao;
	}

	//取得全部的省/直辖市的名称
	@Override
	public List<AddressCode> getProvinceList() throws AppBusinessException {
		return addressCodeDao.getProvinceList();
	}

	/**
	 * author Bruce Zhang
	 * @param province
	 * @return			根据省/直辖市取得市/区
	 * @throws AppBusinessException
	 */
	@Override
	public List<AddressCode> getCityByProvince(String province)
			throws AppBusinessException {
		return addressCodeDao.getCityByProvince(province);
	}

	/**
	 * author Bruce Zhang
	 * @param city		城市/直辖市的区
	 * @return			根据市/区取得县/街道
	 * @throws AppBusinessException
	 */
	@Override
	public List<AddressCode> getCountyByCity(String city)
			throws AppBusinessException {
		return addressCodeDao.getCountyByCity(city);
	}

	/**
	 * author Bruce Zhang
	 * @param county	县
	 * @return			根据县取得镇/街道
	 * @throws AppBusinessException
	 */
	@Override
	public List<AddressCode> getTownByCounty(String county)
			throws AppBusinessException {
		return addressCodeDao.getTownByCounty(county);
	}

}
